-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat #140] 채팅 요청 목록 조회 API #141
Conversation
Code Coverage
|
Test Results 25 files 25 suites 14s ⏱️ Results for commit 445c947. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스크럼 때 말씀해주신 부분을 살펴보았는데 바로 생각나진 않네요..!
고생하셨습니다.
.toList(); | ||
|
||
List<LatestChatMessage> latestChatMessages | ||
= chatMessageQueryRepository.findLatestChatByChatRoomIds(chatRoomIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
�가장 최신의 채팅 메시지 목록을 가져오는 메서드는 분리를 통해 중복을 줄일 수 있을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getChatPartner()를 리팩토링해도 괜찮겠네요.
if문에서 바로 return을 던져주고 있기 때문에 else과 else if문을 사용을 줄여도 좋을 것 같아요
private Member getChatPartner(Long memberId, ChatRoom chatRoom) {
if (Objects.equals(chatRoom.getAnswerer().getId(), memberId)) {
return chatRoom.getInquirer();
}
if (Objects.equals(chatRoom.getInquirer().getId(), memberId)) {
return chatRoom.getAnswerer();
}
throw new ValidationException(ChatErrorCode.UNAUTHORIZED_CHAT_ROOM);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니면 더 좋게 바꿀 수 도 있을 것 같아요. Member 객체에서 memberId만 getter통해 가져오기 보다는 Member 객체가 스스로 일을 하도록 하는거죠.
public class Member {
private Long memberId;
....
public boolean isSameId(Long otherId) {
return Objects.equals(otherId);
}
}
private Member getChatPartner(Member member, ChatRoom chatRoom) {
if (member.isSameId(chatRoom.getAnswerer()) {
return chatRoom.getInquirer();
}
if (member.isSameId(chatRoom.getInquirer()))) {
return chatRoom.getAnswerer();
}
throw new ValidationException(ChatErrorCode.UNAUTHORIZED_CHAT_ROOM);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵. 제안주신 부분 다음 PR에 참고해서 반영하겠습니다! 감사합니다
관련 이슈
📑 작업 상세 내용
요청중
상태의 표시 UI가 다름 ->요청대기
,수락하기
isInquirer
,chatStatus
필드 추가💫 작업 요약
🔍 중점적으로 리뷰 할 부분